[][src]Crate dbase

dbase is rust library meant to read and write

Reading

To Read the whole file at once you should use the read function.

Once you have access to the records, you will have to match against the real FieldValue

Examples

use dbase::FieldValue;
let records = dbase::read("tests/data/line.dbf").unwrap();
for record in records {
    for (name, value) in record {
        println!("{} -> {:?}", name, value);
        match value {
            FieldValue::Character(Some(string)) => println!("Got string: {}", string),
            FieldValue::Numeric(value) => println!("Got numeric value of  {:?}", value),
            _ => {}
        }
    }
}

You can also create a Reader and iterate over the records.

let reader = dbase::Reader::from_path("tests/data/line.dbf").unwrap();
for record_result in reader {
    let record = record_result.unwrap();
    for (name, value) in record {
        println!("name: {}, value: {:?}", name, value);
    }
}

Structs

FieldFlags
Reader

Struct with the handle to the source .dbf file Responsible for reading the content

Writer

Struct that handles the writing of records to any destination that supports the Write trait

Enums

Error

Errors that may happen when reading a .dbf

FieldValue

Enum where each variant stores the record value

Functions

read

One liner to read the content of a .dbf file

write_to

Writes the records to the dest

write_to_path

Writes all the records to the a new file at path

Type Definitions

Record

Type definition of a record. A .dbf file is composed of many records